import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Assert;
import org.junit.Test;

public class CalculatorTest {

	@Test
	public void testAdd() {
		Calculator calculator = new Calculator();
		int res = calculator.add(3, 5);
		Assert.assertSame(8, res);
	}

	@Test
	public void testFoo() {
		int a[] = { 21, 35, 14, 62, 18, 35, 6 };
		int r[] = a;
		int low = 0;
		int high = 6;

		int i, j, x;
		if (low >= high)
			return;
		i = low;
		j = high;
		x = r[i];
		do {
			while ((r[j] >= x) && (j > i)) {
				j--;
			}
			if (i < j) {
				r[i] = r[j];
				i++;
			}
			while ((r[i] <= x) && (j > i))
				i++;
			if (i < j) {
				r[j] = r[i];
				j--;
			}
		} while (i < j);
		r[j] = x;
		
		for (int k = 0; k < r.length; k++) {
			System.out.print(r[k] + ", ");
		}
		System.out.println();

	}

	@Test
	public void testDate(){
		Date date = new Date();
		String string = new SimpleDateFormat("yy-MM-dd mm:ss").format(date);
		System.out.println(string);
	}

}
